package com.hundsun.documentripper.filter;

import com.hundsun.documentripper.error.UnknownSessionException;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Note：
 *
 * @author ：mengjw
 * @description：登录拦截器
 * @date ：Created in 2021/3/18
 */
@Component
public class LoginHandlerInterceptor implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        if (StringUtils.isEmpty(request.getSession().getAttribute("userUuid"))) {
//            // 之后可以改成返回到登录页，先报错
//           throw new UnknownSessionException();
//        }
        return true;
    }

}